package model

import (
	"gorm.io/gorm"
	"shop-server/basic/config"
)

type Shop struct {
	gorm.Model
	Name  string  `gorm:"type:varchar(20);not null;comment:'商品名称'"`
	Price float64 `gorm:"type:decimal(10,2);not null;comment:'商品价格'"`
	Stock int     `gorm:"type:int;not null;comment:'商品库存'"`
}

type Status struct {
	gorm.Model
	ShopId int    `gorm:"type:int;not null;comment:'商品ID'"`
	Status int    `gorm:"type:tinyint;not null;comment:'状态'"`
	Reason string `gorm:"type:varchar(50);not null;comment:'原因'"`
}

func (s *Status) CreateStatus() error {
	return config.DB.Debug().Create(&s).Error
}
